﻿using System;
using System.Collections.Generic;
using System.Text;
using Lon.Util;

namespace Lon.Data
{
    public interface  INetDataRec 
    {
        /// <summary>
        /// 数据时间
        /// </summary>
        DateTime Time { get; }
        /// <summary>
        /// 简要描述
        /// </summary>
        String Desp { get; }

        DataDir DataDir { get; }

        byte[] Data { get; }       
        String DataStr { get; }
        

    }

    public class RawDataRecBase:INetDataRec
    {
        /// <summary>
        /// 数据时间
        /// </summary>
        public DateTime Time { get; protected set; }
        /// <summary>
        /// 简要描述 
        /// </summary>
        public String Desp { get; protected set; }

        public  DataDir DataDir { get; protected set; }

        public  byte[] Data { get; protected set; }

        /// <summary>
        /// 根据需要重写
        /// </summary>
        public virtual String DataStr
        { 
            get
            {
                if (Data == null) return "";
                return StringHelper.ByteArr2HexString(Data, 0, Data.Length, " ");
            } 
        }

    }


   

   
    public enum DataDir
    {
           [EnumString("接收")]
           Recive=0,
           [EnumString("发送")]
           Transmit=1,
           [EnumString("未知")]
           UnKnow=2
    }
    
}

